pull: Correctly handle error state when fetching optional data
authorColin Walters <walters@verbum.org>
Tue, 29 Apr 2014 13:02:43 +0000 (09:02 -0400)
committerColin Walters <walters@verbum.org>
Tue, 29 Apr 2014 14:59:57 +0000 (10:59 -0400)
For the static deltas work, we're using the already-extant internal
API to perform a HTTP fetch for optional data - static deltas are
optional.

Except that we didn't correctly unset the error if we were doing an
optional fetch and the data wasn't found.

src/libostree/ostree-repo-pull.c

index 0d9eaf8bbe1e6d7942051647d6ce06f0c1944b9b..427bd9240f362bbd66e5ed29a558be0f5fe80a3d 100644 (file)
@@ -293,11 +293,14 @@ fetch_uri_contents_membuf_sync (OtPullData    *pull_data,
   run_mainloop_monitor_fetcher (pull_data);
   if (!fetch_data.result_stream)
     {
-      if (allow_noent && g_error_matches (*error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+      if (allow_noent)
         {
-          g_clear_error (error);
-          ret = TRUE;
-          *out_contents = NULL;
+          if (g_error_matches (*error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+            {
+              g_clear_error (error);
+              ret = TRUE;
+              *out_contents = NULL;
+            }
         }
       goto out;
     }